<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.beaut.project.util.FlowUtility" %>
<%@ include file="/public/header.jsp"%>
<%
	String addGDAction = request.getParameter("addGDAction") == null ? "" : request.getParameter("addGDAction");
	String statusType = request.getParameter("statusType") == null ? "" : request.getParameter("statusType");
	String contractFlag = request.getParameter("contractFlag") == null ? "" : request.getParameter("contractFlag");
%>
<html>
	<head>
		<title>项目管理</title>
	</head>
	<script type="text/javascript">
		$(function(){
			$("#searchValue").keypress(function(e) { 
		    	// 回车键事件 
		     	if(e.which == 13) { 
		     		 doSearch();
		       	} 
			});
			$("#dept_id").combotree({
				url:'<%=contextPath %>/springMVC/group/listDepartment',
				method:'POST',
				animate:true,
				lines:true,
				onChange:function(){
					doSearch();
				}
			});
			$("#table").datagrid({
				title:"项目管理",
				iconCls:'icon-edit',
				loadMsg:'正在加载数据，请稍后......',
				url:'<%=contextPath %>/springMVC/xm/listPageXmCg',
				rownumbers:true,
				fitColumns:true,
				nowrap:false,
				idField:'id',
				frozenColumns:[[
				    {title:'主键',field:'id',hidden:true},
				    {title:'工单id',field:'gd_id',hidden:true},
				    {title:'管理员id',field:'admin_id',hidden:true}
				]],
				columns:[[
					{title:'创建时间',field:'xm_createtime',width:150,align:'center'},
					{title:'部门id',field:'admin_dept_id',hidden:true},
					{title:'部门',field:'admin_dept',width:100,align:'center'},
					{title:'项目编号',field:'xm_code',width:100,align:'center'},
					{title:'项目名称',field:'xm_name',width:200,align:'center'},
					{title:'到款金额',field:'has_receivable',width:200,align:'center'},
					{title:'客户id',field:'customer_id',hidden:true},
					{title:'客户',field:'customer',hidden:true},
					{title:'专业分类',field:'specialty_type',hidden:true},
					{title:'项目管理员',field:'admin_name',width:100,align:'center'},
					{title:'开工时间',field:'start_time',hidden:true},
					{title:'选择操作',field:'more',width:80,align:'center',formatter:function(value,rowData,rowIndex){
						return "<input type='button' style='border:0px #ff0000 solid;width:16px;height:16px;cursor:pointer;' class='icon-ok' title='选择此项目' onclick=\"javascript:choseXm('"+rowData.id+"','"+rowData.xm_code+"','"+rowData.xm_name+"','"+rowData.admin_dept_id+"','"+rowData.admin_dept+"','"+rowData.customer_id+"','"+rowData.customer+"','"+rowData.has_receivable+"','"+rowData.admin_id+"');\"/>";
					}}
				]],
				onDblClickRow:function(rowIndex, rowData){
					choseXm(rowData.id,rowData.xm_code,rowData.xm_name,rowData.admin_dept_id,rowData.admin_dept,rowData.customer_id,rowData.customer,rowData.has_receivable,rowData.admin_id);
				},
				pageSize:10,
				pageList : [10,50,100],  
				pagination:true,
				toolbar:"#tb",
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
		});

		
		function  viewData(id){
			openDialogResize("<%=contextPath %>/springViews/xm/viewXm.jsp?xm_id="+id+"&callback=rtCallBack",1000, 800);
	
		}
		
		function rtCallBack(){
			$('#table').datagrid('reload');
		}
		function choseXm(id,code,name,dept_id,dept,customer_id,customer,has_receivable,admin_id){
				window.opener.rtCallBackXmSet(id,code,name,dept_id,dept,customer_id,customer,has_receivable,admin_id);
				window.close();
		}
		function doSearch()
		{
			var start_time=$('#start_time').datebox('getValue');  
			var end_time=$('#end_time').datebox('getValue');  
			var searchValue = $('#searchValue').val();
			var dept_id = $("#dept_id").combotree('getValue');
			$('#table').datagrid('load',{
				searchValue:searchValue,
				dept_id :dept_id,
				start_time:start_time,
				end_time:end_time
				
			});
		}
	</script>
	<body style="height: 97%">
		<div id="table" data-options="fit:true" ></div>
		<div id="tb" style="padding:3px;height:auto">
			<div align="right">
				开始时间：<input id="start_time" name="start_time" class="easyui-datebox" />&nbsp;&nbsp;&nbsp;结束时间：<input id="end_time" name="end_time" class="easyui-datebox" />
				所属部门：<input  id="dept_id" name="dept_id" class="easyui-combotree">&nbsp;&nbsp; 
				项目编号/名称：<input id="searchValue" name="searchValue" style="width:150px" title="项目名称或编码" placeholder="项目名称或编码 "  />&nbsp;&nbsp; 
				<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch();"></a>
			</div>
	</body>
</html>
